package com.baoke.service;

import com.spring.BeanPostProcessor;
import com.spring.Component;

/**
 * @author 暴珂
 * @version 1.0
 * @description
 * @date 2024/6/4 13:27:28
 */
@Component
public class BaokeBeanPostProcessor implements BeanPostProcessor {

    @Override
    public Object PostProcessorBeforeInitialization(Object bean, String beanName) {
        if (beanName.equals("userService")) {
            System.out.println("初始化前");
            ((UserService) bean).setName("哈哈哈哈哈");
        }
        return bean;
    }

    @Override
    public Object PostProcessorAfterInitialization(Object bean, String beanName) {
        System.out.println("初始化后");
        return bean;
    }
}
